package curiosity.servlet.rol;

import java.io.IOException;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
//import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;




import curiosity.excepcion.DAOExcepcion;
import curiosity.negocio.GestionBusOportunidad;


/**
 * Servlet implementation class RolBusOportunidadServlet
 */
@WebServlet("/RolBusOportunidadServlet")
public class RolBusOportunidadServlet extends javax.servlet.http.HttpServlet
implements javax.servlet.Servlet {
	static final long serialVersionUID = 1L;

	/*
	 * (non-Java-doc)
	 * 
	 * @see javax.servlet.http.HttpServlet#HttpServlet()
	 */
    public RolBusOportunidadServlet() {
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
			
		System.out.println("dentro de rolbusoportunidadservlet");
		
		String a = request.getParameter("fecha_vigencia");
		String b = request.getParameter("puesto_laboral");
	
		
		GestionBusOportunidad negocio = new GestionBusOportunidad();
		try {
			negocio.obtener(a, b);
			
			//negocio.insertar(a, b);
			response.sendRedirect(request.getContextPath()	+ "/fbuscadoroferta.jsp");
		} catch (DAOExcepcion e1) {
			RequestDispatcher rd = request.getRequestDispatcher("error.jsp");
			rd.forward(request, response);
	}
	}
}